package com.smedi.ismedi.file.core.domain.service.impl;

import com.smedi.ismedi.file.core.domain.aggregatemodel.FileInfo;
import com.smedi.ismedi.file.core.domain.aggregatemodel.FileRepository;
import com.smedi.ismedi.file.core.domain.service.FileDomainService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Jimmy
 * @Date 2021/6/1 14:22
 */
@Service
@AllArgsConstructor
public class FileDomainServiceImpl implements FileDomainService {
    private final FileRepository fileRepository;

    /**
     * {@inheritDoc}
     */
    @Override
    public FileInfo fileUpLoad(FileInfo fileInfo) {
        return fileRepository.addFileInfo(fileInfo);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public FileInfo getFileInfo(String signKey) {
        return fileRepository.getFileBySignKey(signKey);
    }

    @Override
    public List<FileInfo> getFileInfo(List<String> signKeys) {
        return fileRepository.getFileList(signKeys);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean deleteFileBySignKey(String signKey, String reason) {
        return fileRepository.deleteFileBySignKey(signKey, reason);
    }

}
